package com.vista.questionnaire.exception;


import com.fasterxml.jackson.databind.annotation.JsonSerialize;

/**
 * <p>错误描述符</p>
 *
 * @author Vincent
 * @version 0.1.0
 * @since 0.1.0
 */
@JsonSerialize(using = ErrorDescriptorSerializer.class)
public enum ErrorDescriptor {

    DataDamaged(10000, "提交的数据不完整"),
    DataLogicError(10001, "提交的数据不符合逻辑"),
    DataUpdateInExistenceError(10002, "更新失败、尝试更新不存在的数据"),
    DataInsertInExistenceError(10003, "新建失败、尝试为不存在的父级建立子级"),
    DataDeleteInExistenceError(10004, "删除失败、尝试删除不存在的数据"),
    DataAccountError(10005, "数据错误，人员账号信息错误"),
    DataNotFoundError(10006, "数据库中未找到该数据"),

    AuthenticationFailed(10404, "用户名或者密码错误"),
    TokenNotFoundInUri(10405, "请求地址未包含token参数"),


    EunmPraseError(10406, "枚举包装出错"),
    InputPraseError(10407, "输入不符合题目定义"),
    QuestionDupError(10408, "题目定义多个for标签"),




    ;


    // 枚举值
    private final int code;

    // 枚举可读名称
    private final String description;

    ErrorDescriptor(int code, String description) {
        this.code = code;
        this.description = description;
    }

    public int getCode() {
        return this.code;
    }

    public String getDescription() {
        return this.description;
    }

    @Override
    public String toString() {
        return description;
    }
}
